#include "Entity.h"
#include "EntityManager.h"
#include "System.h"
#include "Logger.h"
namespace BPL
{

EntityManager* Entity::entityManager = 0;

Entity::Entity(EntityId id):mpt_id(id)
{

}
Entity::~Entity()
{
	for(std::vector<System*>::iterator itr = mpt_systems.begin(); itr != mpt_systems.end(); itr++)
	{
		if(*itr != NULL)
			(*itr)->deleteEntity(mpt_id);
	}
#ifdef DEFINE_MODE
	std::string str = "delete Entity :";
	str += boost::lexical_cast<std::string>(mpt_id);
	Logger::log(str.c_str());
#endif
}
EntityId Entity::getID() const
{
    return mpt_id;
}

void Entity::addSystem(System* system)
{
	mpt_systems.push_back(system);
}

}
